﻿using System;
using SmartMenu.Controllers;
using visinia.SmartEngine;

public partial class Admin_Pages__Menu_Menu_Menus : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void NEW_Menu_Click(object sender, EventArgs e)
    {
        Response.Redirect(SystemMenu.CallPage("SmartMenu", "AddMenu"));
    }

    public string GetEditLink(int MenuId)
    {
        return SystemMenu.CallPage("SmartMenu", "EditMenu", "MenuId", MenuId.ToString());
    }

    public string GetLink(int MenuId)
    {
        return SystemMenu.CallPage("SmartMenu", "MenuItems", "MenuId", MenuId.ToString());
    }

    protected void GridViewMenus_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
    {
        if (e.CommandName == "DeleteMenu")
        {
            int menuId = Convert.ToInt32(e.CommandArgument);
            MenuController.DeleteMenu(menuId);            
            Response.Redirect(Request.RawUrl);
        }
    }
}